<extend name="template/base_index" />

<block name="area_header">
	<link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
	<script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
	<link type="text/css" rel="stylesheet" href="__CDN__/comp/wxuploader.css?v=__APP_VERSION__" />
	<link type="text/css" rel="stylesheet" href="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
	<script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
</block>

<block name="area_body">
	{:W('Menus/topbar')}
	<div class="admin-main container-fluid">
		{:W('Menus/left')}
		<div class="admin-main-content">
			{:W('Menus/breadcrumb')}

			<!-- 带验证 form -->
			<form class="form-horizontal well validateForm">
				<input type="hidden" name="img_url"  id="img_url"  />
				<fieldset>
					<legend>
						投票选项添加
					</legend>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">选项名称</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-normal"  name="option_name" id="inputtitle" placeholder="请不要超过35个字">
							<div class="help-block">(不要超过35个字)</div>
						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">选项图片</label>
						<div class="col-md-10 col-lg-10">
							
							<!-- 图片选择DOM结构 -->
							<div class="wxuploaderimg clearfix" data-maxitems="1">
								<div class="img-preview clearfix" >
									
								</div>
								<div class="add">
									<i class="fa fa-plus"></i>
								</div>
							</div>							
							<!-- 图片选择DOM结构 -->
							

						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">排序</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-short" name="sort" value="0">
						</div>
					</div>
					
					<div class="form-group">
						<label for="btns" class="col-md-2 col-lg-2 control-label">&nbsp;</label>
						<div class="col-lg-10 col-md-10">
							<a target-form="validateForm" class="ajax-post btn btn-primary" onclick="return getData();" href="{:U('Admin/VoteOption/add',array('vote_id'=>$vote_id))}" autofocus="autofocus"><i class="fa fa-save"></i> {:L('BTN_SAVE')}</a>
							<a class="btn btn-default" href="{:U('Admin/VoteOption/index',array('vote_id'=>$vote_id))}"><i class="fa fa-reply"></i>返回</a>
						</div>
					</div>
				</fieldset>
			</form>
			<!-- form -->
			<include file="template/wxpicture" />

		</div>
		<!-- END admin-main-content -->
	</div>
	<!-- END admin-main-->
</block>

<block name="area_footer">

	<script>
	
		function getData(){
			var img_url = $(".wxuploaderimg img").attr("src");
			$("#img_url").val(img_url);
			return true;
		}
		
		$(function() {
			$('#enddatetime').datetimepicker({
				lang: 'ch'
			});
			
			wxuploadimg.init({cont:".wxuploaderimg"});
		});

	</script>
</block>